import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 发票内容字典信息 */
export interface InvoiceContentDict {
          name?: string; // 品名
          model: string; // 型号规格
          unit: string; // 单位
          quantity: number; // 数量
          unitPrice: number; // 单价
          amount: number; // 金额
  }

// 发票内容字典 API
export const InvoiceContentDictApi = {
  // 查询发票内容字典分页
  getInvoiceContentDictPage: async (params: any) => {
    return await request.get({ url: `/biz/invoice-content-dict/page`, params })
  },

  // 查询发票内容字典详情
  getInvoiceContentDict: async (id: number) => {
    return await request.get({ url: `/biz/invoice-content-dict/get?id=` + id })
  },

  // 新增发票内容字典
  createInvoiceContentDict: async (data: InvoiceContentDict) => {
    return await request.post({ url: `/biz/invoice-content-dict/create`, data })
  },

  // 修改发票内容字典
  updateInvoiceContentDict: async (data: InvoiceContentDict) => {
    return await request.put({ url: `/biz/invoice-content-dict/update`, data })
  },

  // 删除发票内容字典
  deleteInvoiceContentDict: async (id: number) => {
    return await request.delete({ url: `/biz/invoice-content-dict/delete?id=` + id })
  },

  /** 批量删除发票内容字典 */
  deleteInvoiceContentDictList: async (ids: number[]) => {
    return await request.delete({ url: `/biz/invoice-content-dict/delete-list?ids=${ids.join(',')}` })
  },

  // 导出发票内容字典 Excel
  exportInvoiceContentDict: async (params) => {
    return await request.download({ url: `/biz/invoice-content-dict/export-excel`, params })
  },
  // 下载导入模板
  importTemplate: async () => {
    return await request.download({ url: '/biz/invoice-content-dict/get-import-template' })
  }
}
